Script Controls GraphCalc scripts support two types of control structures, if/else and while. These commands work just like they do in other programming languages. Keep in mind that commads, as with most of GraphCalc's features are case sensitive.
The if/else structure allows for a true/false condition to determine
which set of commands to follow. Note that the ElseIf and Else sections are optional.
Here is the syntax:
The while structure allows for looping of a set of commands while a boolean
condition is true. Here is the syntax: One additional command that is often useful in controlling the execution of scripts is the ExitScript command which ceases execution of the script. Here is an example of a trivial script showing conditional statements: If(irand(0:100) > 50) [Comment="If"] ElseIf(irand(0:10) < 5) [Comment="first ElseIf"] ElseIf(irand(0:10) > 5) [Comment="second ElseIf"] Else [Comment="Else"] EndIf
i=irand(1:10) While(i > 0) i=i-irand(1:4) i=i+irand(1:2) EndWhile |